<me:UIAP05 x:Class="WPFExcelReport.TAPARTK"
                    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
                    xmlns:ucd="clr-namespace:ReflectionStudio.Controls;assembly=ReflectionStudio.Controls"     
                    xmlns:me="clr-namespace:WPFExcelReport" 
                    xmlns:ex="clr-namespace:WPFExcelReport.Controls;assembly=ExControls"
                    xmlns:T="clr-namespace:WPFExcelReport;assembly=IntexBL"  
                    xmlns:SD="clr-namespace:WPFExcelReport;assembly=TSDDAT"  
                     xmlns:DR="clr-namespace:WPFExcelReport;assembly=TDRAUFTR"  
                    xmlns:KS="clr-namespace:WPFExcelReport;assembly=TKSTSTELL" 
                    xmlns:MEK="clr-namespace:WPFExcelReport;assembly=TMEKOPF"  
                   xmlns:WF="clr-namespace:WPFExcelReport;assembly=TICC_WFEVENTS"  
                    xmlns:Localization="clr-namespace:Localization;assembly=Localization"
                    x:Name="TV"
                    Loaded="Window_Loaded"
     >
    <me:UIAP05.Resources>
        <CollectionViewSource  x:Key="vwMaster"/>       <CollectionViewSource  x:Key="vwDetail"/>
        <ucd:Divideby10  x:Key="d10"/>
        <ucd:BoolToVisibilityConverter  x:Key="bv"/>
        <ucd:NOTBoolToVisibilityConverter  x:Key="nbv"/>
        <ucd:NOTConverter x:Key="not"/>
        <ucd:Divideby100  x:Key="d100"/>
        <ucd:Divideby1000  x:Key="d1000"/>
        <ucd:Divideby10000 x:Key="dw"/>
        <ucd:GB2312Convert8859P1  x:Key="gb2312"/>
    </me:UIAP05.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="1*"></RowDefinition> 
            <RowDefinition Height="Auto"></RowDefinition>
        </Grid.RowDefinitions>
        <StackPanel Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2"  > 
            <WrapPanel   > 
                <Grid Margin="10,0,0,0"  VerticalAlignment="Top" 
                      Visibility="{Binding IsNew,ElementName=TV,Converter={StaticResource nbv}}">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button Grid.Column="0"  Click="NewCommand" Height="20" Margin="5,0,0,0" Width="24"
                            IsEnabled="{Binding IsCanNew,ElementName=TV}"
                            >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Add.png" />
                        </Button.Background>
                    </Button>
                </Grid>
                <Grid Margin="10,0,0,0"  VerticalAlignment="Top" 
                      Visibility="{Binding IsNew,ElementName=TV,Converter={StaticResource bv}}">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button Grid.Column="0"  Click="NewCommand" Height="20" Margin="5,0,0,0" Width="24"
                            IsEnabled="{Binding IsCanNew,ElementName=TV}"
                            >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/button_ok.png" />
                        </Button.Background>
                    </Button>
                </Grid>
                <Grid Margin="10,0,0,0" VerticalAlignment="Top" 
                      Visibility="{Binding IsEdit,ElementName=TV,Converter={StaticResource bv}}">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button Click="DeleteCommand" Height="20" Margin="5,0,0,0" Width="24" >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Remove.png" />
                        </Button.Background>
                    </Button>
                </Grid>
                <SD:K0228  IsEdit="{Binding IsEdit,ElementName=TV}"
                                  KEY="{Binding AMTYP,ElementName=TV}"
                                  />

                <MEK:TSAE04  
                    IsEdit="{Binding IsEdit,ElementName=TV}"
                    KST="{Binding KST,ElementName=TV}"
                    AGANG="{Binding AGANG,ElementName=TV}"
                    EXAUF="{Binding AMTYP,ElementName=TV}"
                    KEY="{Binding ART,ElementName=TV}"
               />
            </WrapPanel>  
            <WrapPanel Visibility="Collapsed">
                <ex:TXT72  MaxLength="2" CharacterCasing="Upper"  Text="{Binding APAKAGANG}" IsReadOnly="{Binding IsEdit,ElementName=TV,Converter={StaticResource not}}" Width="40"/>
                <ex:TXT72  MaxLength="2" CharacterCasing="Upper"  Text="{Binding APAKMTYP}" IsReadOnly="{Binding IsEdit,ElementName=TV,Converter={StaticResource not}}" Width="40"/>

                <ex:TXT72  MaxLength="2" CharacterCasing="Upper"  Text="{Binding APAKPKSTKRS}" IsReadOnly="{Binding IsEdit,ElementName=TV,Converter={StaticResource not}}" Width="40"/>
                <ex:TXT72  MaxLength="2" CharacterCasing="Upper"  Text="{Binding APAKPKST}" IsReadOnly="{Binding IsEdit,ElementName=TV,Converter={StaticResource not}}" Width="40"/>
                <ex:TXT72  MaxLength="2" CharacterCasing="Upper"  Text="{Binding APAKMNRKRS}" IsReadOnly="{Binding IsEdit,ElementName=TV,Converter={StaticResource not}}" Width="40"/>
                <ex:TXT72  MaxLength="2" CharacterCasing="Upper"  Text="{Binding APAKMLFDNR}" IsReadOnly="{Binding IsEdit,ElementName=TV,Converter={StaticResource not}}" Width="40"/>
                <ex:TXT72  MaxLength="2" CharacterCasing="Upper"  Text="{Binding APAKMPOS}" IsReadOnly="{Binding IsEdit,ElementName=TV,Converter={StaticResource not}}" Width="40"/>
                <ex:TXT72  MaxLength="2" CharacterCasing="Upper"  Text="{Binding APAKEVARHNR}" IsReadOnly="{Binding IsEdit,ElementName=TV,Converter={StaticResource not}}" Width="40"/>
                <ex:TXT72  MaxLength="2" CharacterCasing="Upper"  Text="{Binding APAKEVARUNR}" IsReadOnly="{Binding IsEdit,ElementName=TV,Converter={StaticResource not}}" Width="40"/>
                <ex:TXT72  MaxLength="2" CharacterCasing="Upper"  Text="{Binding APAKFIX}" IsReadOnly="{Binding IsEdit,ElementName=TV,Converter={StaticResource not}}" Width="40"/>
            </WrapPanel>
            <WrapPanel>
                <TextBlock Text="{Binding Source={Localization:Translate Word=速度:}}"/>
                <ex:NumericBox  Text="{Binding APAKBASMGE,Converter={StaticResource d1000}}" IsReadOnly="{Binding IsEdit,ElementName=TV,Converter={StaticResource not}}" Width="40"/>
                <SD:K9320 KEY="{Binding APAKME,ElementName=TV}"
                          IsEdit="{Binding IsEdit,ElementName=TV}"/>
                <ex:NumericBox  Text="{Binding APAKME}" IsReadOnly="{Binding IsEdit,ElementName=TV,Converter={StaticResource not}}" Width="40"/>
                <ex:NumericBox  Text="{Binding APAKMASCHANZ}" IsReadOnly="{Binding IsEdit,ElementName=TV,Converter={StaticResource not}}" Width="40"/>
                <SD:K0514 KEY="{Binding APAKMASCHZE,ElementName=TV}"
                          IsEdit="{Binding IsEdit,ElementName=TV}"/>
                <ex:TXT72  Text="{Binding APAKMASCHZE}" IsReadOnly="{Binding IsEdit,ElementName=TV,Converter={StaticResource not}}" Width="40"/>
                <ex:NumericBox  Text="{Binding APAKMASCHZT,Converter={StaticResource d100}}" IsReadOnly="{Binding IsEdit,ElementName=TV,Converter={StaticResource not}}" Width="40"/>
            </WrapPanel>
        </StackPanel>
        <DataGrid  Grid.Row="1"  Grid.Column="0" 
                   VerticalAlignment="Top"  
                   AutoGenerateColumns="False"
                   EnableRowVirtualization="False"
                   IsReadOnly="True"
                   VerticalScrollBarVisibility="Auto"
                   HorizontalScrollBarVisibility="Auto"
                   HeadersVisibility="Column"     
                   ItemsSource="{Binding Source={StaticResource ResourceKey=vwMaster}}" 
                   IsSynchronizedWithCurrentItem="True" 
                   x:Name="dlgMaster"  
                   RowDetailsVisibilityMode="Visible"  
                    >
            <DataGrid.Columns>
                <DataGridTextColumn Binding="{Binding APAKAEVOR}" Header="{Binding Source={Localization:Translate Word=设定}}" Width="Auto"/>
                <DataGridTextColumn Binding="{Binding APAKMTYP}"  Width="Auto"/>
                <DataGridTextColumn  Binding="{Binding APAKEVARHNR}" Header="{Binding Source={Localization:Translate Word=标准工艺}}" Width="Auto"/>
                <DataGridTextColumn  Binding="{Binding APAKEVARUNR}" Header="{Binding Source={Localization:Translate Word=编号}}" Width="Auto"/>
                <DataGridTextColumn  Binding="{Binding APAKART}" Header="{Binding Source={Localization:Translate Word=品种}}" Width="Auto"/>
                <DataGridTextColumn  Binding="{Binding APAKVAR}" Header="{Binding Source={Localization:Translate Word=VAR}}" Width="Auto"/>
                <DataGridTextColumn  Binding="{Binding APAKZUSATZ}" Header="{Binding Source={Localization:Translate Word=后整理}}" Width="Auto"/> 
            </DataGrid.Columns>
        </DataGrid>     
        
    </Grid>
</me:UIAP05>
